package project15;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        for(int i=0;i<10;i++)
        {
            String name=null;
            String order=null;
            String user=null;
            System.out.println("输入物品名称:");
            name=sc.next();
            System.out.println("输入物品序号:");
            order=sc.next();
            System.out.println("输入用户:");
            user=sc.next();
            arrangement.setthings(new things(name,order,user));
            System.out.println("继续：1 结束：0");
            int f=sc.nextInt();
            boolean flag=(f==1);
            if(!flag)
                break;
        }
        System.out.println("请输入物品序号");
        String b=sc.next();
        System.out.println("该序号对应的物品为："+arrangement.getthings(b));
    }
}
class things
{
    private String name;
    private String order;
    private String user;

    public things(String name, String order, String user) {
        this.name = name;
        this.order = order;
        this.user = user;
    }

    public String getName() {
        return name;
    }

    public String getOrder() {
        return order;
    }

    public String getUser() {
        return user;
    }
}
class arrangement
{
    static int i=0;
    static things[] arr=new things[10];
    public static void setthings(things a)
    {
        if(i<10)
        arr[i++]=a;
        else
            System.out.println("超出容量");
    }
    public static String getthings(String a)
    {
        for(int j=0;j<10;++j)
        {
            if(arr[j].getOrder().equals(a))
            {
                return arr[j].getName();
            }
        }
        System.out.println("未能查询到");
        return null;
    }
}

